//==========================================================================
// Copyright (c) 2000-2008,  Elastos, Inc.  All Rights Reserved.
//==========================================================================
#ifndef __KEYBOARD_H__
#define __KEYBOARD_H__

#include <driver.h>
#include "eventqueue.h"

class CKeyboard: public CDeviceDriver
{
public:
    CARAPI Read(
        /* [in] */  Int64 offset,
        /* [in] */  Int32 numberOfBytesToRead,
        /* [out] */ MemoryBuf * pData,
        /* [out] */ IEvent * * ppCompletionEvent);

    CARAPI Write(
        /* [in] */  Int64 offset,
        /* [in] */ const  MemoryBuf & ebbData,
        /* [out] */ Int32 * pNumberOfBytesWritten,
        /* [out] */ IEvent * * ppCompletionEvent);

    CARAPI Control(
        /* [in] */  Handle32 controlCode,
        /* [in] */ const  MemoryBuf & ebbInData,
        /* [out] */ MemoryBuf * pOutData,
        /* [out] */ IEvent * * ppCompletionEvent);

    void Dispose();

public:
    STATIC ECode S_Create(
        /* [in] */ Int32 environmentId,
        /* [out] */ IDeviceDriver ** pKeyboard);

    STATIC CKeyboard * S_Get(
        /* [in] */ Int32 environmentId);


public:
    CEventQueue * GetQueue() { return m_pEventQueue; }

public:
    virtual ~CKeyboard();
private:
    CKeyboard(Int32 environmentId)
            : m_environmentId(environmentId) {}

    ECode Initialize();

private:
    Int32 m_environmentId;
    CEventQueue * m_pEventQueue;
};

typedef struct _KeyboardParams
{
    CKeyboard * pKeyboard;
    PVoid pParams;
}KeyboardParams;

#endif //__KEYBOARD_H__

